﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.WeihuDome.ShiguDataManager.Dto;
using AbpVueDemo.WeihuguanliDemo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.WeihuDome.ShiguDataManager
{
   public  class ShiguDataService : AsyncCrudAppService<ShiguData, ShiguDataInputDto, int, PageShiguDataRequestDto, ShiguDataCreateDto, ShiguDataUpdateDto>, IShiguDataService
    {
        public ShiguDataService(
    IRepository<ShiguData, int> repository) : base(repository)
        {

        }
        /// <summary>
        /// 自定义分页条件查询, 需要重写父类的CreateFilteredQuery方法,让其进行自定义条件筛选
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        protected override IQueryable<ShiguData> CreateFilteredQuery(PageShiguDataRequestDto input)
        {
            return base.CreateFilteredQuery(input)

                 .WhereIf(!string.IsNullOrEmpty(input.biaoti), c => c.biaoti.Contains(input.biaoti))
                  .WhereIf(!string.IsNullOrEmpty(input.chepaihao), c => c.chepaihao.Contains(input.chepaihao))
                   // .WhereIf(input.zhuangtai > 0, c => c.zhuangtai == input.zhuangtai)
                   .WhereIf(input.riqi.HasValue, c => c.riqi == input.riqi);
        }
    }
}
